package com.studyroom.controller;

import com.studyroom.dto.Result;
import com.studyroom.entity.Note;
import com.studyroom.service.NoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("note")
public class NoteController {
    @Autowired
    private NoteService noteService;
    @RequestMapping("getByUserId")
    public Result getByUserId(@RequestParam Long id){
        return noteService.getByUserId(id);
    }
    @RequestMapping("delById")
    public Result delById(@RequestParam Long id){
        return noteService.delById(id);
    }
    @RequestMapping("addOrUpdate")
    public Result addOrUpdate(@RequestBody Note note){
        return noteService.addOrUpdate(note);
    }
}
